//
//  main.cpp
//  构造函数重载
//
//  Created by mac on 16/3/8.
//  Copyright © 2016年 mac. All rights reserved.
//

#include <iostream>

using namespace std;

class Date{
private:
    int year;
    int month;
    int day;
public:
    Date();
    ~Date();
    Date(int x,int y, int z);
    void ShowList(){
        cout<<year<<"-"<<month<<"-"<<day<<endl;
    }
};
Date::~Date(){
    cout<<"Destructor called!"<<endl;
}
//若未定义析构函数，则编译系统隐式生成一个缺省析构函数，用来释放分配给对象的存储空间

Date::Date(){
    year=2016;
    month=3;
    day=8;
}
Date::Date(int x,int y,int z){
    year=x;
    month=y;
    day=z;
}
int main(int argc, const char * argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";
    Date Time;
    cout<<"The time is:";
    Time.ShowList();
    Date Time2(2015,3,9);
    cout<<endl<<"Tomorrow is:";
    Time2.ShowList();
    cout<<endl;
    return 0;
}
